package com.ylr.Postconttruct;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

/**
 * @ClassName TestPostcontruct
 * @Description TODO
 * @Author 11
 * @Date 2021/7/9 16:25
 * @Version 1.0
 */


@Service
@Slf4j
public class TestPostcontruct {
    @Autowired
    private BBB bbb;


    public BBB getBbb() {
        return bbb;
    }

    public TestPostcontruct() {
//        System.out.println(bbb.getName());
        log.info("我是构造方法 给bbb一个值: 我是构造方法");
//        bbb.setName("我是构造方法");
    }

    @PostConstruct
    public void test(){
        System.out.println(bbb.getName());
        log.info("我是构造方法 给bbb一个值: 我是test方法");
        bbb.setName("我是test方法");
    }

}
